guitools
Class Tools

java.lang.Object
  extended by guitools.Tools

public class Tools
extends java.lang.Object

Various tools for GUIs. Some are useful, others are... not useful unless you are laying out exactly as I do.

Author:
Steven de Jong, steven.dejong@cs.unimaas.nl

Field Summary
static java.awt.Frame currentDialogOwner
          Current dialog owner, handy global variable.
static boolean FANCY_DIALOG
          Apply a style to dialogs or not?
static javax.swing.border.AbstractBorder gbBorder
          Complete border around gridbagged panels.
static javax.swing.border.AbstractBorder gbBorderNoMargin
          No-bottom-margin border around gridbagged panels.
static java.awt.Color LIGHT_SELECTION
          A color between control and selection.
 
Constructor Summary
Tools()
           
 
Method Summary
static void bindButtonsToComponent(java.awt.Component t, javax.swing.AbstractButton enter, javax.swing.AbstractButton esc)
          Give the component a keylistener that responds to the keys ENTER and ESC and will 'press' the two buttons (can be null).
static void bindButtonToList(javax.swing.JList list, javax.swing.JButton btn)
          Map double-clicking a list to a button fire.
static void bindButtonToList(javax.swing.JList list, javax.swing.JButton btn, int nClick)
          Map n-clicking a list to a button fire.
static void borderize(javax.swing.JComponent b)
          Apply fancy border and font to the component.
static void borderize(javax.swing.JComponent b, boolean includeSpace)
          Apply fancy border and font to the component, with or without margin within the border.
static void borderize(javax.swing.JComponent b, java.awt.Color c)
          Apply fancy border (color specified) and font to the component.
static void borderize(javax.swing.JComponent b, java.awt.Color c, boolean includeSpace)
          Apply fancy border (color specified) and font to the component, with or without margin within the border.
static void buttonize(javax.swing.AbstractButton b)
          Apply fancy layout to the button.
static void buttonize(javax.swing.AbstractButton b, java.awt.Color c)
          Apply fancy layout to the button, with bordercolor specified.
static void centerWindow(java.awt.Window w)
          Center the window on screen.
static void dialogize(javax.swing.JDialog d)
          Create a really fancy dialog.
static void font(javax.swing.JComponent b)
          Give the component a nice font.
static void fontBold(javax.swing.JComponent b)
          Give the component a nice bold font.
static int getScreenHeight()
          Return height of the desktop in pixels.
static int getScreenWidth()
          Return width of the desktop in pixels.
static javax.swing.ImageIcon loadIcon(java.lang.String fileName)
          Load an icon.
static javax.swing.JDesktopPane makeDesktop()
          Make a desktop.
static void makeInternalFrame(javax.swing.JInternalFrame f)
          Make internal frame.
static void makeMenu(javax.swing.JMenu m)
          Prevent Swing from using, what, 200 different ugly fonts...
static void makeMenuButton(javax.swing.AbstractButton but)
          Make menu button.
static void makeMenuButton(javax.swing.AbstractButton but, boolean hover)
          Make menu button with or without hovering effect.
static void makeReadable(javax.swing.JComponent component, java.awt.Color bgColor)
          Update colour for component; adjust the foreground colour to something readable.
static void print(double[] data)
          Print array.
static void print(java.lang.Object[] data)
          Print array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentDialogOwner

public static java.awt.Frame currentDialogOwner
Current dialog owner, handy global variable.


FANCY_DIALOG

public static boolean FANCY_DIALOG
Apply a style to dialogs or not?


LIGHT_SELECTION

public static java.awt.Color LIGHT_SELECTION
A color between control and selection. Fancy!


gbBorderNoMargin

public static javax.swing.border.AbstractBorder gbBorderNoMargin
No-bottom-margin border around gridbagged panels.


gbBorder

public static javax.swing.border.AbstractBorder gbBorder
Complete border around gridbagged panels.

Constructor Detail

Tools

public Tools()
Method Detail

getScreenWidth

public static int getScreenWidth()
Return width of the desktop in pixels.


getScreenHeight

public static int getScreenHeight()
Return height of the desktop in pixels.


centerWindow

public static void centerWindow(java.awt.Window w)
Center the window on screen.


loadIcon

public static javax.swing.ImageIcon loadIcon(java.lang.String fileName)
Load an icon.


buttonize

public static void buttonize(javax.swing.AbstractButton b)
Apply fancy layout to the button.


buttonize

public static void buttonize(javax.swing.AbstractButton b,
                             java.awt.Color c)
Apply fancy layout to the button, with bordercolor specified.


borderize

public static void borderize(javax.swing.JComponent b)
Apply fancy border and font to the component.


borderize

public static void borderize(javax.swing.JComponent b,
                             java.awt.Color c)
Apply fancy border (color specified) and font to the component.


borderize

public static void borderize(javax.swing.JComponent b,
                             boolean includeSpace)
Apply fancy border and font to the component, with or without margin within the border.


borderize

public static void borderize(javax.swing.JComponent b,
                             java.awt.Color c,
                             boolean includeSpace)
Apply fancy border (color specified) and font to the component, with or without margin within the border.


font

public static void font(javax.swing.JComponent b)
Give the component a nice font.


fontBold

public static void fontBold(javax.swing.JComponent b)
Give the component a nice bold font.


bindButtonsToComponent

public static void bindButtonsToComponent(java.awt.Component t,
                                          javax.swing.AbstractButton enter,
                                          javax.swing.AbstractButton esc)
Give the component a keylistener that responds to the keys ENTER and ESC and will 'press' the two buttons (can be null). Very convenient in, for example, a popup input box or something.


bindButtonToList

public static void bindButtonToList(javax.swing.JList list,
                                    javax.swing.JButton btn)
Map double-clicking a list to a button fire.


bindButtonToList

public static void bindButtonToList(javax.swing.JList list,
                                    javax.swing.JButton btn,
                                    int nClick)
Map n-clicking a list to a button fire.


dialogize

public static void dialogize(javax.swing.JDialog d)
Create a really fancy dialog.


print

public static void print(java.lang.Object[] data)
Print array.


print

public static void print(double[] data)
Print array.


makeReadable

public static void makeReadable(javax.swing.JComponent component,
                                java.awt.Color bgColor)
Update colour for component; adjust the foreground colour to something readable.


makeMenu

public static void makeMenu(javax.swing.JMenu m)
Prevent Swing from using, what, 200 different ugly fonts...


makeMenuButton

public static void makeMenuButton(javax.swing.AbstractButton but)
Make menu button.


makeMenuButton

public static void makeMenuButton(javax.swing.AbstractButton but,
                                  boolean hover)
Make menu button with or without hovering effect.


makeInternalFrame

public static void makeInternalFrame(javax.swing.JInternalFrame f)
Make internal frame.


makeDesktop

public static javax.swing.JDesktopPane makeDesktop()
Make a desktop.